
#ifndef _VNCSERVER_H_
#define _VNCSERVER_H_
//author:xdz
//date:2008-10-19
#include "IVNCServer.h"

class CVNCServer:public IVNCServer
{
public:
	CVNCServer();
	virtual ~CVNCServer();
public:
	unsigned short AddClient( ISocket* socket, bool bAuth, bool bShared );
	unsigned short AddClient( ISocket* socket, bool bAuth, bool bShared,char* protocolMsg );
	unsigned short AddClient( ISocket* socket, bool bAuth, bool bShared,int nCapability,char* protocolMsg );
	bool Authenticated( unsigned short uClientId );
	void KillClient( unsigned short uClientId );
	void KillClient( char* szClientName );
	void TextChatClient( char* szClientName );
	unsigned int AuthClientCount();
	unsigned int UnauthClientCount();
	void KillAuthClients();
	void WaitUntilAuthEmpty();
	void KillUnauthClients();
	void WaitUntilUnauthEmpty();
	bool UpdateWanted();
	bool RemoteEventReceived();

	IVNCClient* GetClient( unsigned short uClientId );
	vncClientList ClientList();

	void SetCapability( unsigned short uClientId , int nCapability );
	void SetKeyboardEnabled( unsigned short uClientId , bool bEnabled );
	void SetPointerEnabled( unsigned short uClientId , bool bEnabled );

	int GetCapability( unsigned short uClientId );
	const char* GetClientName( unsigned short uClientId );

	void RemoveClient( unsigned short uClientId );
	
	void SingleWindow( bool bEnabled);
	bool SingleWindow();
	void SetSingleWindowName(const char *szName);
	char *GetWindowName();
	IVNCDesktop* GetDesktopPointer();
	void SetNewSWSize(long w,long h,bool bDesktop);
	void SetSWOffset(int x,int y);
	void SetScreenOffset(int x,int y,int type);

	bool All_clients_initialalized();
	rfb::UpdateTracker &GetUpdateTracker();
	void UpdateMouse();
	void UpdateClipText(const char* text);
	void UpdatePalette();
	void UpdateLocalFormat();

	void PollUnderCursor(bool bEnable);
	bool PollUnderCursor();
	void PollForeground(bool bEnable);
	bool PollForeground();
	void PollFullScreen(bool bEnable);
	bool PollFullScreen();

	void Driver(bool bEnable);
	bool Driver();
	void Hook(bool bEnable);
	bool Hook();
	void Virtual(bool bEnable);
	bool Virtual();
	void SetHookings();

	void PollConsoleOnly(bool bEnable);
	bool PollConsoleOnly() ;
	void PollOnEventOnly(bool bEnable);
	bool PollOnEventOnly();

	void UpdateLocalClipText( char* text);

	void SetName(const char * name);
	void SetPorts(const unsigned int nPort_rfb, const unsigned int nPort_http);
	unsigned int GetPort();
	unsigned int GetHttpPort();

	void SetAutoPortSelect(const bool bAutoport);
	bool AutoPortSelect();

	void SetPassword(const char *passwd);
	void GetPassword(char *passwd);
	void EnableRemoteInputs(bool bEnable);
	bool RemoteInputsEnabled();

	void DisableLocalInputs(bool disable);
	bool LocalInputsDisabled();

	void SetConnectPriority( unsigned int priority );
	unsigned int ConnectPriority();

	bool SockConnect(bool bOn);
	bool SockConnected();
	bool SetLoopbackOnly(bool bLoopbackOnly);
	bool LoopbackOnly();

	bool SetDisableTrayIcon(bool bDisableTrayIcon);
	bool GetDisableTrayIcon();
	bool SetAllowEditClients(bool bAllowEditClients);
	bool GetAllowEditClients();

	bool EnableHTTPConnect(bool enable);= 0
		bool HTTPConnectEnabled();
	bool EnableXDMCPConnect(bool enable);
	bool XDMCPConnectEnabled();

	void GetScreenInfo(int &width, int &height, int &depth);

	void SetAuthRequired(bool bReqd);
	bool AuthRequired();

	void SetAuthHosts(const char *hostlist);
	char *AuthHosts();
	AcceptQueryReject VerifyHost(const char *hostname);

	void AddAuthHostsBlacklist(const char *machine);
	void RemAuthHostsBlacklist(const char *machine);

	void SetQuerySetting(const unsigned int setting);
	unsigned int QuerySetting();
	void SetQueryAccept(const unsigned int setting);
	unsigned int QueryAccept();
	void SetQueryTimeout(const unsigned int setting);
	unsigned int QueryTimeout();

	void SetQueryIfNoLogon(const unsigned int setting);
	bool QueryIfNoLogon();

	void SetLoopbackOk(bool bOk);
	bool LoopbackOk();

	void SetLockSettings(int ok);
	int LockSettings();

	void SetAutoIdleDisconnectTimeout(const unsigned int timeout);
	unsigned int AutoIdleDisconnectTimeout();

	void EnableRemoveWallpaper(const bool bEnable);
	bool RemoveWallpaperEnabled();


	unsigned int GetDefaultScale();
	bool SetDefaultScale(int nScale);
	bool FileTransferEnabled();
	bool EnableFileTransfer(bool bEnable);
	bool BlankMonitorEnabled();
	void BlankMonitorEnabled(bool bEnable);
	bool MSLogonRequired();
	bool RequireMSLogon(bool bEnable);
	bool GetNewMSLogon();
	bool SetNewMSLogon(bool bEnable);
}

#endif